<%--
  Created by IntelliJ IDEA.
  User: kurong
  Date: 2021/10/26
  Time: 8:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/res/jquery/jquery-3.5.1.js" charset="utf-8"></script>
</head>
<body>


</body>



<script src="${pageContext.request.contextPath}/res/jquery/jquery-3.5.1.js"></script>
<script src="${pageContext.request.contextPath}/res/jsencrypt/bin/jsencrypt.min.js"></script>
<script>
    var PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClbnT3sQYW1PGQtxpnCks7HeHa/KbK1bxjqdG1BxskWDFA0ve5eiZ37PE0nxrgn6VeIBTv4L8KFQ/lFDvzmHH12Gsi4R8e3gLMZhoEpCcqzhwD51Fb9S8rH/LVK72SsT02WFi/uLbab5ViaxB5Lry64GyAknGvl6VAV8vWcwsxMQIDAQAB\n';

    var encrypt = new JSEncrypt();
    //encrypt.setPrivateKey('-----BEGIN RSA PRIVATE KEY-----'+PRIVATE_KEY+'-----END RSA PRIVATE KEY-----');
    encrypt.setPublicKey('-----BEGIN PUBLIC KEY-----' + PUBLIC_KEY + '-----END PUBLIC KEY-----');
    var encrypted = encrypt.encrypt('1136610037@qq.com');
    console.log('公钥:%o', PUBLIC_KEY);
    console.log('加密后数据:%o', encrypted);



    var PRIVATE_KEY = 'MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKVudPexBhbU8ZC3GmcKSzsd4dr8psrVvGOp0bUHGyRYMUDS97l6Jnfs8TSfGuCfpV4gFO/gvwoVD+UUO/OYcfXYayLhHx7eAsxmGgSkJyrOHAPnUVv1Lysf8tUrvZKxPTZYWL+4ttpvlWJrEHkuvLrgbICSca+XpUBXy9ZzCzExAgMBAAECgYAg8vAPCU4aLA108lMq5Kz5OElssVeTHKDqBL/E24Z3Za1hqOM4KPESf7nG7k2PIZzxM1iYMl46ZtmEmdQa/2jq56eGvJ8foPNHXH/s5jRDWXj7/u2HRq4f8y0O/wHk5GoLNCqBlbHZQO5JxnndqWiKZN7OsrvefMUmNPb6wx8nsQJBAPv2i6tDHLm8m0g2QtX/I1Hn8i2K62YBOsvYF6JJrz7jfVctuj5N4i5DEhYe8vbJCwFsBJfn8P/H6RMpg6sGzZUCQQCoFP4N/YBYgPHA6+hwZ/lon6xK1mFqGq/MSeyf+EYXO5YDE33Qyz+M5Zu57zoY/+jMNZVYr5KIBmPWXqqGZVYtAkEAxTVYZkiWEC42H9QQhew3WeFAZTMJQgKOYYQWI3imyINH1Fc/IYrWED2Ax32bz1rV2VwRUFBDCgAPRmdE3jTp7QJABNRNlGNTO7fAunVMwWYLYXks/x13wQ+xO2JoXRRKF0LMBZyawdQFKGw0dDwuZCd+LdfgSaMJx8S/O5qOtbvVpQJAB/Lc2GFEtkYE501jsCplmr9yyxmhHr+mF1ULg+FeeyuGkN7x1YwyJQJ5iSwYdBavGg/uWl18BbSpSGCocCIMgg==\n';

    //使用私钥解密
    var decrypt = new JSEncrypt();
    //decrypt.setPublicKey('-----BEGIN PUBLIC KEY-----' + PUBLIC_KEY + '-----END PUBLIC KEY-----');
    decrypt.setPrivateKey('-----BEGIN RSA PRIVATE KEY-----'+PRIVATE_KEY+'-----END RSA PRIVATE KEY-----');
    var uncrypted = decrypt.decrypt(encrypted);
    console.log('解密后数据:%o', uncrypted);


</script>

</html>
